//
//  ViewController.swift
//  PureLayoutDemo
//
//  Created by 贺嘉炜 on 2016/12/19.
//  Copyright © 2016年 贺嘉炜. All rights reserved.
//

import UIKit
import SnapKit


class ViewController: UIViewController {
    
    @IBOutlet weak var grayView: UIView!
    @IBOutlet weak var redView: UIView!
    @IBOutlet weak var greenView: UIView!
    @IBOutlet weak var blueView: UIView!
    

    
    func demo35() {
        let size = CGSize(width: 50, height: 50)
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(size)
            make.center.equalTo()(0)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(size)
            make.center.equalTo(0)
        }
        
        redView.autoSetDimensions(to: size)
        redView.autoAlignAxis(toSuperviewAxis: .horizontal)
        redView.autoAlignAxis(toSuperviewAxis: .vertical)
    }
    
    func demo34() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.right().equalTo()(0)
            make.bottom.height().equalTo()(1)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.right.equalTo(0)
            make.bottom.height.equalTo(1)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 0, -1, 0), excludingEdge: .top)
        redView.autoSetDimension(.height, toSize:1)
    }
    
    
    func demo32() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.centerX.equalTo()(0)
            make.width.equalTo()(self.grayView.mas_width)
        }
        greenView.snp.makeConstraints () { (make) in
            make.centerX.equalTo(0)
            make.width.equalTo(self.grayView.snp.width)
        }
        
        redView.autoAlignAxis(toSuperviewMarginAxis: .vertical)
        redView.autoSetDimension(.width, toSize:grayView.bounds.size.width)
        
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.bottom.equalTo()(0)
            make.top.equalTo()(100)
        }
        greenView.snp.makeConstraints () { (make) in
            make.bottom.equalTo(0)
            make.top.equalTo(100)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .bottom, withInset:0)
        redView.autoPinEdge(toSuperviewEdge: .top, withInset:100)
    }
    
    func demo31() {
        let priceLabel = UILabel(frame: .zero)
        priceLabel.backgroundColor = UIColor.yellow
        priceLabel.adjustsFontSizeToFitWidth = true
        greenView.addSubview(priceLabel)
        
        priceLabel.mas_makeConstraints () { (m) in
            let make = m!
            make.top.bottom().right().equalTo()(0)
            make.left.equalTo()(self.redView.mas_right)
            make.width.equalTo()(50)
        }
        
        priceLabel.snp.makeConstraints () { (make) in
            make.top.bottom.right.equalTo(0)
            make.left.equalTo(self.redView.snp.right)
            make.width.equalTo(50)
        }
        
//        priceLabel.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 0, 0, 0), excludingEdge: .leading)
//        priceLabel.autoPinEdge(.leading, to: .trailing, of: redView, withOffset: 0)
//        priceLabel.autoSetDimension(.width, toSize:50)
    }
    
    func demo30() {
        let checkButton = UIButton()
        checkButton.frame = CGRect(x:185, y:12, width:18, height:18)
        checkButton.backgroundColor = UIColor.yellow
        greenView.addSubview(checkButton)
        checkButton.mas_makeConstraints () { (m) in
            let make = m!
            make.top.equalTo()(6)
            make.bottom.equalTo()(-6)
            make.right.equalTo()(-20)
        }
        
        checkButton.snp.makeConstraints () { (make) in
            make.top.equalTo(6)
            make.bottom.equalTo(-6)
            make.right.equalTo(-20)
        }
        
        checkButton.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(6, 0, 6, 20), excludingEdge: .left)
    }
    
    func demo29() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.top.bottom().equalTo()(0)
            make.left.equalTo()
            make.width.equalTo()(50)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.top.bottom.equalTo(0)
            make.left.equalTo(self.grayView)
            make.width.equalTo(50)
        }
    
        redView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 0, 0, 0), excludingEdge: .leading)
        redView.autoPinEdge(.leading, to: .trailing, of: blueView, withOffset: 0)
        redView.autoSetDimension(.width, toSize:50)
    }
    
    
    func demo28() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.centerX.equalTo()(self.greenView)!.offset()(-120)
            make.centerY.equalTo()(0)
            make.size.equalTo()(CGSize(width: 140, height: 40))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.centerX.equalTo(self.greenView).offset(-120)
            make.centerY.equalTo(0)
            make.size.equalTo(CGSize(width: 140, height: 40))
        }
        
        redView.autoAlignAxis(.vertical, toSameAxisOf: greenView, withOffset: -120)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        redView.autoSetDimensions(to: CGSize(width: 140, height: 40))
    }
    
    func demo27() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.centerX.equalTo()(self.greenView)!.offset()(120)
            make.centerY.equalTo()(0)
            make.size.equalTo()(CGSize(width: 140, height: 40))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.centerX.equalTo(self.greenView).offset(120)
            make.centerY.equalTo(0)
            make.size.equalTo(CGSize(width: 140, height: 40))
        }
        
        redView.autoAlignAxis(.vertical, toSameAxisOf: greenView, withOffset:120)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        redView.autoSetDimensions(to: CGSize(width: 140, height: 40))
    }
    
    func demo26() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.center.equalTo()(0)
            make.size.equalTo()(CGSize(width: 120, height: 40))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.center.equalTo(0)
            make.size.equalTo(CGSize(width: 120, height: 40))
        }
        
        redView.autoAlignAxis(toSuperviewMarginAxis: .vertical)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        redView.autoSetDimensions(to: CGSize(width: 120, height: 40))
    }
    
    func demo25() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.bottom().right().equalTo()(0)
            make.height.equalTo()(50)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.bottom.right.equalTo(0)
            make.height.equalTo(50)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
        redView.autoSetDimension(.height, toSize:50)
        //    filterVc.allheightConstraint =
    }
    
    func demo24() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.centerX.centerY().equalTo()(0)
            make.width.height().equalTo()(84)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.centerX.centerY.equalTo(0)
            make.width.height.equalTo(84)
        }
        
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        redView.autoAlignAxis(toSuperviewMarginAxis: .vertical)
        redView.autoSetDimension(.height, toSize:84)
        redView.autoSetDimension(.width, toSize:84)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        demo23()
    }
    
    func demo23() {
        //参照物
        let referenceView = UIView()
        grayView.addSubview(referenceView)
        referenceView.backgroundColor = UIColor.yellow
        referenceView.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize(width: 100, height: 100))
            make.center.equalTo(self.grayView)
        }
        
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.equalTo()(referenceView.mas_right)!.offset()(10)
            make.top.equalTo()(referenceView.mas_top)
            make.size.equalTo()(CGSize(width: 60, height: 20))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.equalTo(referenceView.snp.right).offset(10)
            make.top.equalTo(referenceView.snp.top)
            make.size.equalTo(CGSize(width: 60, height: 20))
        }

        redView.autoPinEdge(.left, to: .trailing, of:referenceView, withOffset:10)
//        redView.autoset
        redView.autoPinEdge(.top, to: .top, of: referenceView)
        redView.autoSetDimensions(to: CGSize(width: 60, height: 20))
    }
    
    func demo22() {
        let processWordLabel = UILabel()
        grayView.addSubview(processWordLabel)
        processWordLabel.text = "I am a label and I am awesome"
        processWordLabel.backgroundColor = UIColor.yellow
        
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: 43, height: 43))
            make.centerX.equalTo()(0)
            make.top.equalTo()(10)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: 43, height: 43))
            make.centerX.equalTo(self.grayView)
            make.top.equalTo(10)
        }
        
        redView.autoSetDimensions(to: CGSize(width: 43, height: 43))
        redView.autoAlignAxis(toSuperviewAxis: .vertical)
        redView.autoPinEdge(toSuperviewEdge: .top, withInset: 10)
    }
    
    func demo21() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.right().equalTo()(0)
            make.top.equalTo()(10)
            make.height.equalTo()(20)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.right.equalTo(0)
            make.top.equalTo(10)
            make.height.equalTo(20)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:0)
        redView.autoPinEdge(toSuperviewEdge: .trailing, withInset:0)
        redView.autoPinEdge(toSuperviewEdge: .top, withInset:10)
        redView.autoSetDimension(.height, toSize:20)
    }
    
    func demo20() {
//        blueView.mas_makeConstraints () { (m) in
//            let make = m!
//            make.edges.equalTo()(UIEdgeInsetsMake(0, 10, 0, 10))
//        }
//        
//        greenView.snp.makeConstraints () { (make) in
//            make.edges.equalTo(UIEdgeInsetsMake(0, 10, 0, 10))
//        }
//        
//        redView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 10, 0, 10))
    
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.edges.equalTo()(UIEdgeInsetsMake(0, 95, 0, 10))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.edges.equalTo(UIEdgeInsetsMake(0, 95, 0, 10))
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 95, 0, 10))
    }
    
    func demo19() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: 89, height: 22))
            make.left.equalTo()(100)
            make.centerY.equalTo()(0)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: 89, height: 22))
            make.left.equalTo(100)
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoSetDimension(.width, toSize:89)
        redView.autoSetDimension(.height, toSize:22)
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:100)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
    }
    
    func demo18() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: 100,height: 22))
            make.left.equalTo()(10)
            make.centerY.equalTo()(0)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: 100,height: 22))
            make.left.equalTo(10)
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoSetDimension(.width, toSize:100)
        redView.autoSetDimension(.height, toSize:22)
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:10)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
    }
    
    func demo17() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.edges.equalTo()(0)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.edges.equalTo(0)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: .zero)
    }
    
    func demo16() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.bottom().right().equalTo()(0)
            make.height.equalTo()(44)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.bottom.right.equalTo(0)
            make.height.equalTo(44)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
        redView.autoSetDimension(.height, toSize:44)
    }

    func demo15() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: 27,height: 15))
            make.centerY.equalTo()(self.grayView)
            make.left.equalTo()(100)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: 27,height: 15))
            make.centerY.equalTo(self.grayView)
            make.left.equalTo(100)
        }
        
        redView.autoSetDimension(.width, toSize:27)
        redView.autoSetDimension(.height, toSize:15)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        //layoutRecommendHCenter =
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:100)
        //layoutRecommendLeft =
    }
    
    func demo14() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.equalTo()(10)
            make.size.equalTo()(CGSize(width: 29,height: 29))
            make.centerY.equalTo()(self.grayView)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.equalTo(10)
            make.size.equalTo(CGSize(width: 29,height: 29))
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:10)
        redView.autoSetDimension(.width, toSize:29)
        //    redViewViewWidthContraint =
        redView.autoSetDimension(.height, toSize:29)
        //    redViewViewHeightContraint =
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        //    iconCenterXContraint =
    }
    
    func demo13() {
        let SUB_TITLE_WIDTH = UIScreen.main.bounds.width - 83
        
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: SUB_TITLE_WIDTH, height: 20))
            make.left.equalTo()(49)
            make.centerY.equalTo()(self.grayView)!.offset()(8)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: SUB_TITLE_WIDTH, height: 20))
            make.left.equalTo(49)
            make.centerY.equalTo(self.grayView).offset(8)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:49)
        redView.autoSetDimension(.width, toSize:SUB_TITLE_WIDTH)
        //subTitleContraint =
        
        redView.autoSetDimension(.height, toSize:20)
        redView.autoAlignAxis(.horizontal, toSameAxisOf: grayView, withOffset: 8)
        //    layoutSubTitleHeight =
    }
    
    func demo12() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.equalTo()(49)
            make.right.equalTo()(-34)
            make.height.equalTo()(30)
            make.centerY.equalTo()(self.grayView)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.equalTo(49)
            make.right.equalTo(-34)
            make.height.equalTo(30)
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset:49)
        redView.autoPinEdge(toSuperviewEdge: .trailing, withInset:34)
        redView.autoSetDimension(.height, toSize:30)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        //    layoutTitleHeight =
    }
    
    func demo11() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.size.equalTo()(CGSize(width: 24, height: 24))
            make.right.equalTo()(-10)
            make.centerY.equalTo()(self.grayView)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.size.equalTo(CGSize(width: 24, height: 24))
            make.right.equalTo(-10)
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .trailing, withInset:10)
        redView.autoSetDimension(.width, toSize:24)
        redView.autoSetDimension(.height, toSize:24)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
        //chooseBtnCenterXContraint =
    }
    
    func demo10() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.top.left().right().equalTo()(0)
            make.height.equalTo()(50)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.top.left.right.equalTo(0)
            make.height.equalTo(50)
        }
        
        redView.autoSetDimension(.height, toSize:50.0)
        redView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .bottom)
    }
    
    func demo9() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.bottom().right().equalTo()(0)
            make.height.equalTo()(20)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.bottom.right.equalTo(0)
            make.height.equalTo(20)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
        redView.autoSetDimension(.height, toSize:20)
    }
    
    func demo8() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.top.left().equalTo()(0)
            make.size.equalTo()(CGSize(width: 20, height: 20))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.top.left.equalTo(0)
            make.size.equalTo(CGSize(width: 20, height: 20))
        }
        
        redView.autoPinEdge(toSuperviewEdge: .top, withInset:0)
        redView.autoPinEdge(toSuperviewEdge: .left, withInset:0)
        redView.autoSetDimension(.width, toSize:20)
        redView.autoSetDimension(.height, toSize:20)
    }
    
    func demo7() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.top.right().equalTo()(0)
            make.size.equalTo()(CGSize(width: 20,height: 20))
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.top.right.equalTo(0)
            make.size.equalTo(CGSize(width: 20,height: 20))
        }
        
        redView.autoPinEdge(toSuperviewEdge: .top, withInset:0)
        redView.autoPinEdge(toSuperviewEdge: .right, withInset:0)
        redView.autoSetDimension(.width, toSize:20)
        redView.autoSetDimension(.height, toSize:20)
    }
    
    func demo6() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.bottom.equalTo()(1)
            make.left.right().equalTo()(0)
            make.height.equalTo()(1)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.bottom.equalTo(1)
            make.left.right.equalTo(0)
            make.height.equalTo(1)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsetsMake(0, 0, -1, 0), excludingEdge: .top)
        redView.autoSetDimension(.height, toSize:1)
    }
    
    func demo5() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.left.bottom().right().equalTo()(0)
            make.height.equalTo()(20)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.left.bottom.right.equalTo(0)
            make.height.equalTo(20)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with:.zero, excludingEdge: .top)
        redView.autoSetDimension(.height, toSize: 20)
    }
    
    func demo4() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.edges.equalTo()(self.grayView)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.edges.equalTo(self.grayView)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: .zero)

    }
    
    func demo3() {
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.trailing.equalTo()(-10)
            make.size.equalTo()(CGSize(width: 20,height: 12))
            make.centerY.equalTo()(self.grayView)
        }
        
        greenView.snp.makeConstraints () { (make) in
            make.trailing.equalTo(-10)
            make.size.equalTo(CGSize(width: 20,height: 12))
            make.centerY.equalTo(self.grayView)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .trailing, withInset:10)
        redView.autoSetDimensions(to: CGSize(width: 20,height: 12))
        redView.autoAlignAxis(toSuperviewAxis:.horizontal)
    }
    
    func demo2() {

        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.leading.equalTo()(44)
            make.trailing.equalTo()(-40)
            make.height.equalTo()(22)
            make.centerY.equalTo()(0)
        }
        
        greenView.snp.makeConstraints { (make) in
            make.leading.equalTo(44)
            make.trailing.equalTo(-40)
            make.height.equalTo(22)
            make.centerY.equalTo(grayView)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset: 44)
        redView.autoPinEdge(toSuperviewEdge: .trailing, withInset: 40)
        redView.autoSetDimension(.height, toSize: 22)
        redView.autoAlignAxis(toSuperviewAxis: .horizontal)
    }
    
    func demo1() {
        let size = CGSize(width: 24, height: 24)
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.leading.equalTo()(10)
            make.size.equalTo()(size)
            make.centerY.equalTo()(0)
        }
        
        greenView.snp.makeConstraints { (make) in
            make.leading.equalTo(10)
            make.size.equalTo(size)
            make.centerY.equalTo(grayView.snp.centerY)
        }
        
        redView.autoPinEdge(toSuperviewEdge: .leading, withInset: 10)
        redView.autoSetDimensions(to: size)
        redView.autoAlignAxis(toSuperviewMarginAxis: .horizontal)
    }
    
    func demo0() {
        let top:CGFloat = 20.0
        let left:CGFloat = 20.0
        let bottom:CGFloat = 20.0
        let right:CGFloat = 20.0
        
        let padding = UIEdgeInsetsMake(top, left, bottom, right)
        blueView.mas_makeConstraints () { (m) in
            let make = m!
            make.edges.equalTo()(0)!.insets()(padding)
        }
        
        redView.autoPinEdgesToSuperviewEdges(with: padding)
        
//        redView.autoAlignAxis(toSuperviewMarginAxis: .vertical)
//        redView.autoSetDimension(.width, toSize:view.bounds.width)
//        redView.autoPinEdge(toSuperviewEdge: .top, withInset:top)
//        redView.autoPinEdge(toSuperviewEdge: .bottom, withInset:left)
//        redView.autoPinEdge(toSuperviewEdge: .left, withInset:bottom)
//        redView.autoPinEdge(toSuperviewEdge: .right, withInset:right)
    }
    
}

